#ifndef _main_interface_h_
#define _main_interface_h_


#include <vector>
#include <string>
#include <iostream>
using namespace std;
class AlgorithmImpl;

typedef enum OperType {
	DSType = 0x00000001,
	ALType,

};


class Function
{
public:
	Function():impl(nullptr)
	{
	}
	Function(const char* cfg): impl(nullptr) {
		
	}

	~Function()
	{
	}

public:
	//here define some string operations
	bool GenerateTrCvSubset(const char* scp_file_name, float percent, const char* dest_directory);
	bool CheckLM(const char* lm_name);



private:
	AlgorithmImpl* impl;

};


template <typename Elem>
class DynmicP
{
public:
	DynmicP() :ref_(nullptr), hyp_(nullptr), ref_len_(0), hyp_len_(0){}

	virtual ~DynmicP()
	{
		if (ref_)
		{
			delete[] ref_; ref_ = nullptr;
		}
		if (hyp_)
		{
			delete[] hyp_; hyp_ = nullptr;
		}
	}

	Elem operator()(int ref_len, int hyp_len) const {
		Elem result;
		return result;
	
	};
	void SetParams(const char* ref_str, int ref_len, const char* hyp_str, int hyp_len) {
		ref_len_ = ref_len;
		hyp_len_ = hyp_len;
		ResetStorage();
		ref_ = new char[ref_len+1];
		hyp_ = new char[hyp_len+1];
		ref_[ref_len] = '\0';
		hyp_[hyp_len] = '\0';
		memcpy(static_cast<char*>(ref_), const_cast<char*>(ref_str), ref_len);
		memcpy(static_cast<char*>(hyp_), const_cast<char*>(hyp_str), hyp_len);

	};
	void Run() {
		LevenshteinDistanceComputation();
		
	};
	void Stop() {
		this->~DynmicP();
	};

protected:
	void ResetStorage() {
		if (ref_)
		{
			delete[] ref_; ref_ = nullptr;
		}
		if (hyp_)
		{
			delete[] hyp_; hyp_ = nullptr;
		}

	}
	void LevenshteinDistanceComputation() {
		std::vector<std::vector<int> > comp_table;
		comp_table.resize(hyp_len_+1);
		std::string result;
		for (int i=0;i<comp_table.size();i++)
		{
			comp_table[i].resize(ref_len_+1);
		}
		for (size_t i = 0; i < ref_len_; i++)
		{
			for (size_t j=0;j<hyp_len_;j++)
			{

			}
		}
		std::cout << result << std::endl;

	}

private:
	int ref_len_;
	int hyp_len_;
	char* ref_;
	char* hyp_;

};



#endif
